#!/bin/sh /etc/rc.common
START=90
USE_PROCD=1

vis_start() {
	local config="$1"
	local interface

	[ "$config" = "general" ] || return 1

	config_get interface "$config" interface
	if [ "$interface" = "" ]; then
		echo $1 Error, you must specify at least a network interface
		return 1
	fi

	procd_open_instance "${config}"
	procd_set_param command /usr/sbin/vis
	procd_append_param command -D
	procd_append_param command ${interface}
	procd_set_param netdev $interface
	procd_close_instance
}

start_service() {
	config_load "vis"
	config_foreach vis_start vis
}

service_triggers() {
	procd_add_reload_trigger "vis"

	procd_open_trigger
	procd_add_raw_trigger "interface.*" 1000 /etc/init.d/vis reload
	procd_close_trigger
}
